﻿/*
 * 2012  - C.B.S. - Compute Software Solutions
 * This file is part of Observation Log.
 * 
 *     Observation Log is free software: you can redistribute it and/or modify
 *     it under the terms of the GNU General Public License as published by
 *     the Free Software Foundation, either version 3 of the License, or
 *     (at your option) any later version.
 * 
 *     Observation Log is distributed in the hope that it will be useful,
 *     but WITHOUT ANY WARRANTY; without even the implied warranty of
 *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *     GNU General Public License for more details.
 * 
 *     You should have received a copy of the GNU General Public License
 *     along with Observation Log.  If not, see <http://www.gnu.org/licenses/>.
 */
using System;
using System.Windows.Forms;

namespace ObservationLog
{
    public partial class frmViewChart : Form
    {
        private bool _isFullmap = false;

        public string ObjectName { get; set; }
        public int RAHours { get; set; }
        public float RaMinutes { get; set; }
        public int DecDegs { get; set; }
        public float DecMinutes { get; set; }

        public frmViewChart(string objectname, int raHours, float raMinutes, int decDegs, float decMinutes)
        {
            InitializeComponent();
            this.ObjectName = objectname;
            this.RAHours = raHours;
            this.RaMinutes = raMinutes;
            this.DecDegs = decDegs;
            this.DecMinutes = decMinutes;
            this.Text = "View Map - " + ObjectName;
            this.lblHeader.Text = ObjectName + " will be initially centered";
        }

        private void ViewChart_Load(object sender, EventArgs e)
        {
            SetImage();
        }

        private void SetImage()
        {
            this.pictureBox1.Image = Program.GetChartImage(914, 633, 
                this.RAHours, 
                this.RaMinutes, 
                this.DecDegs, 
                this.DecMinutes);
        }
       
        private void button1_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void btnFullMap_Click(object sender, EventArgs e)
        {
            if (this._isFullmap)
            {
                SetImage();
                this.btnFullMap.Text = "Full Map";
                lblHeader.Visible = true;
                this._isFullmap = false;
                this.WindowState = FormWindowState.Normal;
                this.Width = this.panel1.Width;
                this.Height = this.panel1.Height + this.panel1.Top;
            }
            else
            {
                this.pictureBox1.Image = Properties.Resources.Chart;
                lblHeader.Visible = false;
                this.btnFullMap.Text = "Show " + this.ObjectName;
                this.WindowState = FormWindowState.Maximized;
                this._isFullmap = true;
            }
        }
    }
}
